
//引入获取三级导航数据请求的对象并解构

import { reqgetBaseCategoryList, mockAjaxList, mockAjaxFloor } from '@/api'

const state = {
  // 定义三级导航的数据
  Level_three_navigation:
    [
    
    ]
  ,
  //轮播图数据
  lsi_data_list: [
    
  ],

  //楼层数据

  fool_data_list:[]

}
const actions = {
  //异步请求所以放这三级导航
  async  gain_Level_three_navigation({commit}) {
    const three_data = await reqgetBaseCategoryList()
    if (three_data.code === 200) {
    commit('SAVE_Level_three_navigation',three_data.data)
      
    } else {
      console.log('请求错误');
    }
  },

  // 轮播图数据
  async  slideshow_data({commit}) {
    const sli_data = await mockAjaxList()

    if (sli_data.code === 200) {
    commit('SLIDESHOW_SATA',sli_data.data)
      
    } else {
      console.log('请求错误');
    }
  },

  //楼层数据

  async floor_data({commit}) {
    const flo_data = await mockAjaxFloor()
    if (flo_data.code === 200) {
      commit('FLoor_DATA',flo_data.data)
    }
  }
}


const mutations = {
  //储存三级导航数据
  SAVE_Level_three_navigation(state,data) {
    state.Level_three_navigation=data
  },

  //储存轮播图数据
  SLIDESHOW_SATA(state,data) {
 state.lsi_data_list=data
  },

  //储存楼层数据
  FLoor_DATA(state, data) {

    state.fool_data_list=data
  }
}
const getters = {}

export default {
  namespaced:true, //设置命名空间 用来区分不同的模块
  state,
  actions,
  mutations,
  getters
}
